<template>
  <el-select-v2 v-model="attendanceGroupId" :options="options" :props="props" value-key="id"/>
</template>
<script lang="ts" setup>
import {ref} from "vue"
import {ElSelectV2} from "element-plus";
import {getAttendanceGroups} from "@/api/attendanceGroup";
import {AttendanceGroupResponse} from "@/api/types/attendanceGroup";

const attendanceGroupId = defineModel<number>()
const options = ref<AttendanceGroupResponse[]>([])
const props = {
  label: "name",
  value: "id"
}

async function getData() {
  const {data} = await getAttendanceGroups()
  if (data?.info_list !== undefined) {
    options.value = data.info_list
  }
}

getData()
</script>
